import { Rule } from "./types";

export const Flake8SimplifyRuleList: Rule[] = [
    {
        code: "SIM101",
        name: "duplicate-isinstance-call",
        descEn: "Multiple isinstance calls for {name}, merge into a single call",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM102",
        name: "collapsible-if",
        descEn: "Use a single if statement instead of nested if statements",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM103",
        name: "needless-bool",
        descEn: "Return the condition {condition} directly",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM105",
        name: "suppressible-exception",
        descEn: "Use contextlib.suppress({exception}) instead of try-except-pass",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM107",
        name: "return-in-try-except-finally",
        descEn: "Don't use return in try/except and finally",
        descCn: "",
        autoFix: false,
    },
    {
        code: "SIM108",
        name: "if-else-block-instead-of-if-exp",
        descEn: "Use ternary operator {contents} instead of if-else-block",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM109",
        name: "compare-with-tuple",
        descEn: "Use {replacement} instead of multiple equality comparisons",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM110",
        name: "reimplemented-builtin",
        descEn: "Use {repl} instead of for loop",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM112",
        name: "uncapitalized-environment-variables",
        descEn: "Use capitalized environment variable {expected} instead of {original}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM114",
        name: "if-with-same-arms",
        descEn: "Combine if branches using logical or operator",
        descCn: "",
        autoFix: false,
    },
    {
        code: "SIM115",
        name: "open-file-with-context-handler",
        descEn: "Use context handler for opening files",
        descCn: "",
        autoFix: false,
    },
    {
        code: "SIM116",
        name: "if-else-block-instead-of-dict-lookup",
        descEn: "Use a dictionary instead of consecutive if statements",
        descCn: "",
        autoFix: false,
    },
    {
        code: "SIM117",
        name: "multiple-with-statements",
        descEn: "Use a single with statement with multiple contexts instead of nested with statements",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM118",
        name: "in-dict-keys",
        descEn: "Use {key} in {dict} instead of {key} in {dict}.keys()",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM201",
        name: "negate-equal-op",
        descEn: "Use {left} != {right} instead of not {left} == {right}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM202",
        name: "negate-not-equal-op",
        descEn: "Use {left} == {right} instead of not {left} != {right}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM208",
        name: "double-negation",
        descEn: "Use {expr} instead of not (not {expr})",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM210",
        name: "if-expr-with-true-false",
        descEn: "Use bool({expr}) instead of True if {expr} else False",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM211",
        name: "if-expr-with-false-true",
        descEn: "Use not {expr} instead of False if {expr} else True",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM212",
        name: "if-expr-with-twisted-arms",
        descEn: "Use {expr_else} if {expr_else} else {expr_body} instead of {expr_body} if not {expr_else} else {expr_else}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM220",
        name: "expr-and-not-expr",
        descEn: "Use False instead of {name} and not {name}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM221",
        name: "expr-or-not-expr",
        descEn: "Use True instead of {name} or not {name}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM222",
        name: "expr-or-true",
        descEn: "Use {expr} instead of {replaced}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM223",
        name: "expr-and-false",
        descEn: "Use {expr} instead of {replaced}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM300",
        name: "yoda-conditions",
        descEn: "Yoda conditions are discouraged, use {suggestion} instead",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM401",
        name: "if-else-block-instead-of-dict-get",
        descEn: "Use {contents} instead of an if block",
        descCn: "",
        autoFix: true,
    },
    {
        code: "SIM910",
        name: "dict-get-with-none-default",
        descEn: "Use {expected} instead of {original}",
        descCn: "",
        autoFix: false,
    },
];